package com.example.service.implService;

import com.example.config.ResponseVO;
import com.example.mapper.TogetherPersonMapper;
import com.example.pojo.TogetherPerson;
import com.example.service.TogetherPersonService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TogetherPersonServiceImpl implements TogetherPersonService {
    @Resource
    private TogetherPersonMapper togetherPersonMapper;
    @Override
    public ResponseEntity<ResponseVO<String>> addTogetherPerson(TogetherPerson togetherPerson) {
        togetherPerson.setTogetherPersons(togetherPerson.getTogetherPersons());
        int insert = togetherPersonMapper.insert(togetherPerson);
        if(insert>0){
            return ResponseEntity.ok(new ResponseVO<>(HttpStatus.OK, "添加成功"));
        }
        return ResponseEntity.ok(new ResponseVO<>(HttpStatus.BAD_REQUEST, "添加失败"));
    }
}
